package cz.cvut.kbss.owl2query;

import java.util.Arrays;
import java.util.Collection;

import cz.cvut.kbss.owl2query.GenericOWLAPITester.ReasonerPlugin;

// Derivo + Pellet without classification 
//QUERY		 ld onto 	 ld query 	 avgExec 	 stdExec 	# of results	
////==============================================================================
//QUERY		 ld onto 	 ld query 	 avgExec 	 stdExec 	# of results	
//==============================================================================
//
//1-OWLAPI-P	|	146939	3607	23384		0		4,145
//---------------------------------------------------------------------------------//
//2-OWLAPI-P	|	132279	2251	10672		0		1,094
//---------------------------------------------------------------------------------
//
//3-OWLAPI-P	|	89127	8	5463		0		761
//---------------------------------------------------------------------------------
//
//4-OWLAPI-P	|	82651	25	3912		0		3
//---------------------------------------------------------------------------------
//
//6-OWLAPI-P	|	87924	24	255		0		0
//---------------------------------------------------------------------------------
//
//7-OWLAPI-P	|	88996	23	11219		0		0
//---------------------------------------------------------------------------------
//
//8-OWLAPI-P	|	96784	18	9960		0		10,804
//---------------------------------------------------------------------------------
//
//9-OWLAPI-P	|	94668	21	6688		0		1,628
//---------------------------------------------------------------------------------
//
//10-OWLAPI-P	|	99414	java.io.FileNotFoundException: /home/kremen/fel/phd/thesis/queries/query10.sparql (No such file or directory)3	
//	at java.io.FileInputStream.open(Native Method)
//	at java.io.FileInputStream.<init>(FileInputStream.java:120)
//	at cz.cvut.kbss.owl2query.QueryTester$1.loadQuery(QueryTester.java:202)
//	at cz.cvut.kbss.owl2query.SparqldlapiTester.run(SparqldlapiTester.java:156)
//	at cz.cvut.kbss.owl2query.LUBM.main(LUBM.java:293)
//6431		0		1,628
//---------------------------------------------------------------------------------








// Pellet without classification
//QUERY		 ld onto 	 ld query 	 avgExec 	 stdExec 	# of results	
//==============================================================================
//
//11-OWLAPI-P	|	135371	2255	23789		0		11,031
//---------------------------------------------------------------------------------
// QUERY		 ld onto 	 ld query 	 avgExec 	 stdExec 	# of results	
//==============================================================================
//
//1-OWLAPI-P	|	61124	590	7961		0		4,145
//---------------------------------------------------------------------------------
//
//2-OWLAPI-P	|	46185	21	3549		0		1,094
//---------------------------------------------------------------------------------
//
//3-OWLAPI-P	|	48244	19	1497		0		761
//---------------------------------------------------------------------------------
//
//4-OWLAPI-P	|	46444	25	1929		0		3
//---------------------------------------------------------------------------------
//QUERY		 ld onto 	 ld query 	 avgExec 	 stdExec 	# of results	
//==============================================================================
//
//6-OWLAPI-P	|	62889	680	246		0		0
//---------------------------------------------------------------------------------
//
//7-OWLAPI-P	|	48099	22	7781		0		0
//---------------------------------------------------------------------------------
//
//8-OWLAPI-P	|	50626	25	3678		0		10,804
//---------------------------------------------------------------------------------
//
//9-OWLAPI-P	|	44414	29	3133		0		1,628
//---------------------------------------------------------------------------------
//
//10-OWLAPI-P	|	47829	23	296750		0		5,982
//---------------------------------------------------------------------------------
//
//11-OWLAPI-P	|	47059	43	867		0		2,069
//---------------------------------------------------------------------------------
//
//12-OWLAPI-P	|	48607	14	2		0		1
//---------------------------------------------------------------------------------
//
//13-OWLAPI-P	|	46113	21	50		0		0
//---------------------------------------------------------------------------------
//
//14-OWLAPI-P	|	96627	22	5		0		4
//---------------------------------------------------------------------------------
//
//15-OWLAPI-P	|	138662	java.io.FileNotFoundException: /home/kremen/fel/phd/thesis/queries/query15.sparql (No such file or directory)
//0		at java.io.FileInputStream.open(Native Method)
//	at java.io.FileInputStream.<init>(FileInputStream.java:120)
//	at cz.cvut.kbss.owl2query.QueryTester$1.loadQuery(QueryTester.java:212)
//	at cz.cvut.kbss.owl2query.QueryTester.run(QueryTester.java:310)
//	at cz.cvut.kbss.owl2query.LUBM.main(LUBM.java:240)
//3		0		4
//---------------------------------------------------------------------------------



// HermiT without classification
//QUERY		 ld onto 	 ld query 	 avgExec 	 stdExec 	# of results	
//==============================================================================
//
//7-OWLAPI-H	|	50570	3124	14522.6		5725079989.84		0
//---------------------------------------------------------------------------------
//
//8-OWLAPI-H	|	0	30	59506.5		101871083740.98		10,804
//---------------------------------------------------------------------------------
//
//9-OWLAPI-H	|	0	24	210.23		551.51		1,628
//---------------------------------------------------------------------------------

// Pellet without classification
//QUERY		 ld onto 	 ld query 	 avgExec 	 stdExec 	# of results	
//==============================================================================
//
//2-OWLAPI-P	|	72187	1231	3578		0		1,094
//---------------------------------------------------------------------------------
//
//3-OWLAPI-P	|	1	26	2235		0		761
//---------------------------------------------------------------------------------
//
//4-OWLAPI-P	|	0	30	2522		0		3
//---------------------------------------------------------------------------------
//
//6-OWLAPI-P	|	0	41	45		0		0
//---------------------------------------------------------------------------------
//11-OWLAPI-P	|	65674	2733	2429		0		2,069
//---------------------------------------------------------------------------------
//
//12-OWLAPI-P	|	0	13	5		0		1
//---------------------------------------------------------------------------------
//
//13-OWLAPI-P	|	0	19	3		0		0
//---------------------------------------------------------------------------------
//
//14-OWLAPI-P	|	1	4	9		0		4
//---------------------------------------------------------------------------------

// JFACT + classification
//QUERY		 ld onto 	 ld query 	 avgExec 	 stdExec 	# of results	
//==============================================================================
//
//2-OWLAPI-J	|	747957	6060	98959		0		1,094
//---------------------------------------------------------------------------------
//
//3-OWLAPI-J	|	98	166	6732410		0		761
//---------------------------------------------------------------------------------
//
//4-OWLAPI-J	|	65	461	6899572		0		3
//---------------------------------------------------------------------------------
//
//6-OWLAPI-J	|	23	13	238		0		0
//---------------------------------------------------------------------------------
//QUERY		 ld onto 	 ld query 	 avgExec 	 stdExec 	# of results	
//==============================================================================
//
//2-OWLAPI-J	|	701648	920	94922		0		1,094
//---------------------------------------------------------------------------------
//
//3-OWLAPI-J	|	1	23	6528583		0		761
//---------------------------------------------------------------------------------
//
//4-OWLAPI-J	|	0	32	6895119		0		3
//---------------------------------------------------------------------------------
//
//6-OWLAPI-J	|	1	20	56		0		0
//---------------------------------------------------------------------------------
//
//12-OWLAPI-J	|	763918	839	2324		0		1
//---------------------------------------------------------------------------------
//
//13-OWLAPI-J	|	0	22	165		0		0
//---------------------------------------------------------------------------------
//
//14-OWLAPI-J	|	1	18	685		0		29
//---------------------------------------------------------------------------------

// JFACT WITHOUT CLASSIFICATION
//QUERY		 ld onto 	 ld query 	 avgExec 	 stdExec 	# of results	
//==============================================================================
//
//2-OWLAPI-J	|	30901	2514	821919		0		1,094
//---------------------------------------------------------------------------------
//
//2-OWLAPI-J	|	32456	2716	928523		0		1,094
//---------------------------------------------------------------------------------
//
//3-OWLAPI-J	|	1	40	7349028		0		761
//---------------------------------------------------------------------------------
//
//4-OWLAPI-J	|	0	28	7473893		0		3
//---------------------------------------------------------------------------------
//
//6-OWLAPI-J	|	0	23	35		0		0
//---------------------------------------------------------------------------------
//
//7-OWLAPI-J	|	27604	1183	84697.27		206356854125.6		0
//---------------------------------------------------------------------------------
//
//8-OWLAPI-J	|	40	76	21162.2		12807395283.69		0
//---------------------------------------------------------------------------------
//
//9-OWLAPI-J	|	0	46	152.57		1616.25		0
//---------------------------------------------------------------------------------
//
//11-OWLAPI-J	|	35130	3007	44000.67		55956047762.29		0
//---------------------------------------------------------------------------------
//
//11-OWLAPI-J	|	33859	2554	1356645		0		0
//---------------------------------------------------------------------------------
//12-OWLAPI-J	|	0	16	864		0		0
//---------------------------------------------------------------------------------
//
//13-OWLAPI-J	|	0	12	5		0		0
//---------------------------------------------------------------------------------
//
//14-OWLAPI-J	|	0	5	702		0		29
//---------------------------------------------------------------------------------

//QUERY		 ld onto 	 ld query 	 avgExec 	 stdExec 	# of results	
//==============================================================================
//
//2-OWLAPI-H	|	25546	1544	250.3		559665.08		1,094
//---------------------------------------------------------------------------------
//
//3-OWLAPI-H	|	0	85	21047.7		9495272165.28		761
//---------------------------------------------------------------------------------
//
//4-OWLAPI-H	|	1	27	1394.7		65940.68		3
//---------------------------------------------------------------------------------
//
//6-OWLAPI-H	|	0	21	4.93		186.73		0
//---------------------------------------------------------------------------------
//
//
//11-OWLAPI-H	|	56886	2441	73240.87		155054638290.52		2,069
//---------------------------------------------------------------------------------
//12-OWLAPI-H	|	0	10	65.3		42165.48		1
//---------------------------------------------------------------------------------
//
//13-OWLAPI-H	|	0	17	13.53		29.12		0
//---------------------------------------------------------------------------------
//
//14-OWLAPI-H	|	1	11	30.57		89.05		29
//---------------------------------------------------------------------------------

// JFACT
//QUERY		 ld onto 	 ld query 	 avgExec 	 stdExec 	# of results	
//==============================================================================
//
//11-OWLAPI-J	|	34836	3681	1300978		0		0
//---------------------------------------------------------------------------------

public class LUBM {
	public static void main(String[] args) {
		final GenericOWLAPITester q = 
				new SparqldlapiTester();
//		new QueryTester();
		// Collection<Integer> queries = Arrays.asList(1, /* ,2 */3, 4, 5, 6, 7,
		// /*
		// * ,8
		// * ,
		// * 9
		// */
		// 10 /* ,11, 12, 13 */, 14, 15, 16);
		Collection<Integer> queries = Arrays.asList(
//		 1
//		 ,
//		 2, 3, 4,
				 6,
				7
//				, 
//				8, 9, 
//				10
//		 ,
//		 11,
//		 ,
//		 12
//		 , 
//		 13, 14
//		 ,
//				 15,
//				 16,				 5
				);
		// Collection<Integer> queries = Arrays.asList(12);

		final Collection<ReasonerPlugin> rs = Arrays.asList(
		// (ReasonerPlugin) QueryTester);
		// (ReasonerPlugin) QueryTester.kaon2);
//		 (ReasonerPlugin) QueryTester
//				 .getGenericOWLAPIv3(TestConfiguration.get(TestConfiguration.PELLET)))
				(ReasonerPlugin) QueryTester
						.getGenericOWLAPIv3(TestConfiguration.get(TestConfiguration.JFACT)))
		// ,
		// (ReasonerPlugin) QueryTester
		// .getGenericOWLAPIv3(TestConfiguration.JFACT_FACTORY)
		// )
		// (ReasonerPlugin) QueryTester
		// .getGenericOWLAPIv3(TestConfiguration.FACT_FACTORY)
		// )
		;
		// new PelletReasonerFactory()));
		// (ReasonerPlugin) QueryTester
		// .getGenericOWLAPIv3(new ReasonerFactory()));
		// new FaCTPlusPlusReasonerFactory()));// new
		// PelletReasonerFactory()));//
		// new
		// StructuralReasonerFactory()));

		System.out
				.println("QUERY\t\t ld onto \t ld query \t avgExec \t stdExec \t# of results\t");
		System.out
				.println("==============================================================================");

		// String path = "/home/kremen/personal.git/mock/datasets/lubm/";

		// LUBM SPARQLDLNOT queries
		String queryPath = "/home/kremen/fel/phd/thesis/queries/";
		String ontoPath = "/home/kremen/fel/phd/thesis/queries/lubm/";

		// LUBM original queries
		// String queryPath =
		// "/home/kremen/fel/phd/thesis/queries/lubm/original-queries/";
		// String ontoPath = "/home/kremen/fel/phd/thesis/queries/lubm/";

		for (int i : queries) {
			for (final ReasonerPlugin rp : rs) {

				System.out.print("\n" + i + "-" + rp.getAbbr() + "\t|\t");
				q.run(rp, "file://" + queryPath + "query" + i + ".sparql",
						ontoPath + "mapping", 1, "file://" + ontoPath
								+ "univ-bench.owl", "file://" + ontoPath
								+ "University0_0.owl", "file://" + ontoPath
								+ "University0_1.owl", "file://" + ontoPath
								+ "University0_2.owl", "file://" + ontoPath
								+ "University0_3.owl", "file://" + ontoPath
								+ "University0_4.owl", "file://" + ontoPath
								+ "University0_5.owl", "file://" + ontoPath
								+ "University0_6.owl", "file://" + ontoPath
								+ "University0_7.owl", "file://" + ontoPath
								+ "University0_8.owl", "file://" + ontoPath
								+ "University0_9.owl", "file://" + ontoPath
								+ "University0_10.owl", "file://" + ontoPath
								+ "University0_11.owl", "file://" + ontoPath
								+ "University0_12.owl", "file://" + ontoPath
								+ "University0_13.owl", "file://" + ontoPath
								+ "University0_14.owl");
			}
			System.out
					.println("\n---------------------------------------------------------------------------------");
		}
	}
}
